package com.netease.pris.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.ContentObserver;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AutoCompleteTextView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.netease.framework.ActivityEx;
import com.netease.framework.k;
import com.netease.pris.activity.a.ab;
import com.netease.pris.activity.a.p;
import com.netease.pris.atom.ad;
import com.netease.pris.atom.g;
import com.netease.pris.atom.u;
import com.netease.pris.c.l;
import com.netease.pris.v;
import java.util.LinkedList;
import java.util.regex.Pattern;

public class CustomListViewActivity extends ActivityEx
  implements ec
{
  private static Pattern K;
  public static String a = "searchhref";
  public static String b = "customtype";
  public static String c = "customtitle";
  private TextView A;
  private LinearLayout B;
  private TextView C;
  private LinearLayout D;
  private TextView E;
  private TextView F;
  private ab G;
  private Cursor H = null;
  private ContentObserver I;
  private TextWatcher J = new fo(this);
  private View.OnClickListener L = new fr(this);
  private AdapterView.OnItemClickListener M = new fq(this);
  AbsListView.OnScrollListener d = new ft(this);
  com.netease.pris.b e = new fs(this);
  private int f = 0;
  private int g;
  private String h;
  private String i = null;
  private String j = null;
  private String k = null;
  private com.netease.pris.atom.b l;
  private LinkedList m;
  private LinkedList n;
  private boolean o = false;
  private Context p = null;
  private InputMethodManager q;
  private ListView r = null;
  private p s;
  private View t;
  private LinearLayout u;
  private ProgressBar v;
  private TextView w;
  private AutoCompleteTextView x;
  private ImageView y;
  private ImageView z;

  static
  {
    K = Pattern.compile("^\\d+$");
  }

  public static Intent a(Context paramContext)
  {
    return new Intent(paramContext, CustomListViewActivity.class);
  }

  private void a(int paramInt, u paramu, String paramString1, String paramString2)
  {
    switch (paramInt)
    {
    default:
      return;
    case 1100:
      this.f = v.a().d(paramString1, paramString2, this.l);
    case 1105:
    case 304:
    case 309:
    case 303:
    }
    while (true)
    {
      this.n.add(new Integer(this.f));
      break;
      this.f = v.a().e(paramString1, paramString2, this.l);
      continue;
      this.f = v.a().a(paramString1);
      continue;
      this.f = v.a().a(paramu);
      continue;
      this.f = v.a().b(paramu);
    }
  }

  private void a(com.netease.pris.protocol.d paramd)
  {
    String str2;
    try
    {
      String str1 = this.i;
      this.i = null;
      if (paramd.g == null)
        return;
      str2 = paramd.g.b(g.i);
      if (TextUtils.isEmpty(str2))
        return;
      if (str2.equals(str1))
        this.i = null;
    }
    catch (NullPointerException localNullPointerException)
    {
      localNullPointerException.printStackTrace();
    }
    finally
    {
    }
    this.i = str2;
  }

  private void a(com.netease.pris.protocol.d paramd, boolean paramBoolean)
  {
    if (!paramBoolean);
    while (true)
    {
      try
      {
        this.s.a();
        this.s.b(paramd.h);
        if (paramd.h.size() != 0)
          continue;
        if (!k.a(this).c())
          break label179;
        i2 = 2131361862;
        Object[] arrayOfObject2 = new Object[1];
        arrayOfObject2[0] = this.h;
        String str = getString(i2, arrayOfObject2);
        if (this.A != null)
        {
          this.A.setText(Html.fromHtml(str));
          this.A.setVisibility(0);
          this.D.setVisibility(8);
          break label178;
          if (!k.a(this).c())
            break label187;
          i1 = 2131361866;
          Object[] arrayOfObject1 = new Object[1];
          arrayOfObject1[0] = this.h;
          str = getString(i1, arrayOfObject1);
          continue;
          this.s.b(paramd.h);
        }
      }
      catch (NullPointerException localNullPointerException)
      {
        localNullPointerException.printStackTrace();
      }
      finally
      {
      }
      label178: return;
      label179: int i2 = 2131361863;
      continue;
      label187: int i1 = 2131361867;
    }
  }

  private boolean a(com.netease.pris.atom.b paramb)
  {
    boolean bool = false;
    switch (fp.a[paramb.ordinal()])
    {
    default:
    case 2:
    case 1:
    }
    while (true)
    {
      return bool;
      bool = l.a(this.p, com.netease.b.a.d.h().c(), 3);
      continue;
      bool = l.a(this.p, com.netease.b.a.d.h().c(), 1);
    }
  }

  private void b(boolean paramBoolean)
  {
    if (paramBoolean)
    {
      this.u.setVisibility(0);
      this.v.setVisibility(0);
      this.w.setText(2131361949);
    }
    while (true)
    {
      return;
      this.u.setVisibility(8);
    }
  }

  private void c(String paramString)
  {
    try
    {
      String str = this.j;
      if ((paramString != null) && (paramString.length() > 200))
        paramString = paramString.substring(0, 200);
      this.s.a();
      a(1100, null, str, paramString);
      f();
      return;
    }
    catch (NullPointerException localNullPointerException)
    {
      while (true)
        localNullPointerException.printStackTrace();
    }
    finally
    {
    }
    throw localObject;
  }

  private void f()
  {
    Activity localActivity = getParent();
    if ((localActivity instanceof CustomTabActivity))
      ((CustomTabActivity)localActivity).b();
  }

  private void g()
  {
    Activity localActivity = getParent();
    if ((localActivity instanceof CustomTabActivity))
      ((CustomTabActivity)localActivity).c();
  }

  private void h()
  {
    this.r = ((ListView)findViewById(2131558512));
    this.t = LayoutInflater.from(this).inflate(2130903048, null);
    this.r.addFooterView(this.t);
    this.u = ((LinearLayout)this.t.findViewById(2131558426));
    this.v = ((ProgressBar)this.t.findViewById(2131558427));
    this.w = ((TextView)this.t.findViewById(2131558428));
    this.A = ((TextView)findViewById(2131558508));
    this.x = ((AutoCompleteTextView)findViewById(2131558514));
    this.y = ((ImageView)findViewById(2131558515));
    this.z = ((ImageView)findViewById(2131558516));
    this.B = ((LinearLayout)findViewById(2131558517));
    this.C = ((TextView)findViewById(2131558518));
    this.D = ((LinearLayout)findViewById(2131558509));
    this.E = ((TextView)findViewById(2131558510));
    this.F = ((TextView)findViewById(2131558511));
  }

  private void r()
  {
    try
    {
      this.s = new p(this.p);
      this.s.a(this.m);
      this.s.a(this.g);
      this.r.setAdapter(this.s);
      this.G = new ab(this.p);
      this.H = l.a(this);
      this.I = new cj(this, new Handler());
      this.H.registerContentObserver(this.I);
      return;
    }
    catch (NullPointerException localNullPointerException)
    {
      while (true)
        localNullPointerException.printStackTrace();
    }
  }

  private void s()
  {
    try
    {
      this.r.setOnItemClickListener(this.M);
      this.r.setOnScrollListener(this.d);
      this.s.a(this.L);
      this.x.addTextChangedListener(this.J);
      this.x.setAdapter(this.G);
      this.x.setEnabled(false);
      this.C.setOnClickListener(this.L);
      this.y.setOnClickListener(this.L);
      this.z.setOnClickListener(this.L);
      this.z.setClickable(false);
      this.z.setEnabled(false);
      return;
    }
    catch (NullPointerException localNullPointerException)
    {
      while (true)
        localNullPointerException.printStackTrace();
    }
  }

  private void t()
  {
    try
    {
      switch (fp.a[this.l.ordinal()])
      {
      case 1:
        if (!a(com.netease.pris.atom.b.c))
        {
          this.B.setVisibility(0);
          this.C.setText(2131361990);
          this.x.setEnabled(false);
          this.x.setHint("");
          this.x.setText("");
        }
      case 2:
      case 3:
      case 4:
      }
    }
    catch (NullPointerException localNullPointerException)
    {
      localNullPointerException.printStackTrace();
    }
    this.B.setVisibility(8);
    this.x.setEnabled(true);
    this.x.setHint(2131361986);
    this.x.setInputType(1);
    return;
    if (!a(com.netease.pris.atom.b.b))
    {
      this.B.setVisibility(0);
      this.C.setText(2131361991);
      this.x.setEnabled(false);
      this.x.setHint("");
      this.x.setText("");
    }
    else
    {
      this.B.setVisibility(8);
      this.x.setEnabled(true);
      this.x.setHint(2131361987);
      this.x.setInputType(1);
      return;
      this.x.setEnabled(true);
      this.x.setHint(2131361988);
      this.x.setInputType(2);
      this.B.setVisibility(8);
      return;
      this.x.setEnabled(true);
      this.x.setHint(2131361989);
      this.x.setInputType(1);
      this.B.setVisibility(8);
    }
  }

  private void u()
  {
    switch (fp.a[this.l.ordinal()])
    {
    default:
    case 1:
    case 2:
    }
    while (true)
    {
      return;
      MBlogBindActivity.a(this.p, 1);
      continue;
      MBlogBindActivity.a(this.p, 3);
    }
  }

  private void v()
  {
    if ((!this.o) && (this.i != null))
    {
      this.o = true;
      a(1105, null, this.i, this.h);
      this.r.addFooterView(this.t);
      f();
      b(true);
    }
  }

  public String a()
  {
    if (this.x != null);
    for (String str = this.x.getText().toString(); ; str = null)
      return str;
  }

  public void a(String paramString)
  {
    AutoCompleteTextView localAutoCompleteTextView;
    if (this.x != null)
    {
      this.x.setText(paramString);
      localAutoCompleteTextView = this.x;
      if (paramString == null)
        break label43;
    }
    label43: for (int i1 = paramString.length(); ; i1 = 0)
    {
      localAutoCompleteTextView.setSelection(i1);
      this.x.setDropDownHeight(0);
      return;
    }
  }

  public boolean b()
  {
    if (this.B.getVisibility() == 0);
    for (int i1 = 0; ; i1 = 1)
      return i1;
  }

  void c()
  {
    this.H.requery();
    if (!this.H.moveToFirst())
      return;
    label169: 
    while (true)
    {
      switch (this.H.getInt(4))
      {
      case 2:
      default:
      case 1:
      case 3:
      }
      while (true)
      {
        if (this.H.moveToNext())
          break label169;
        break;
        if (this.l != com.netease.pris.atom.b.c)
          continue;
        this.B.setVisibility(8);
        this.x.setEnabled(true);
        this.x.setHint(2131361986);
        this.x.setInputType(1);
        continue;
        if (this.l != com.netease.pris.atom.b.b)
          continue;
        this.B.setVisibility(8);
        this.x.setEnabled(true);
        this.x.setHint(2131361987);
        this.x.setInputType(1);
      }
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903076);
    this.p = this;
    v.a().a(this.e);
    this.m = new LinkedList();
    this.n = new LinkedList();
    this.g = com.netease.b.a.d.f();
    this.q = ((InputMethodManager)getSystemService("input_method"));
    Intent localIntent = getIntent();
    if (localIntent != null)
    {
      this.j = localIntent.getStringExtra(a);
      this.l = ((com.netease.pris.atom.b)localIntent.getSerializableExtra(b));
      this.k = localIntent.getStringExtra(c);
    }
    h();
    r();
    s();
    k();
    t();
  }

  public void onDestroy()
  {
    try
    {
      super.onDestroy();
      v.a().b(this.e);
      com.netease.image.d.a().a(this.g);
      if (this.H != null)
      {
        this.H.unregisterContentObserver(this.I);
        this.H.close();
      }
      if (this.G != null)
        this.G.changeCursor(null);
      this.v.setVisibility(8);
      this.v = null;
      this.n.clear();
      this.m.clear();
      this.s = null;
      this.L = null;
      this.d = null;
      this.M = null;
      this.r = null;
      this.i = null;
      this.t = null;
      this.u = null;
      this.v = null;
      this.w = null;
      this.k = null;
      this.p = null;
      return;
    }
    catch (NullPointerException localNullPointerException)
    {
      while (true)
        localNullPointerException.printStackTrace();
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.CustomListViewActivity
 * JD-Core Version:    0.6.0
 */